package base.tag;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.Tag;

public class BsFormTag extends BsContainerTag<Object> {
	
	private static final long serialVersionUID = 1L;
	
	private String fieldSize = "";
	private String labelWidth = "";
	private String fieldWidth = "";

	@Override
	public int doStartTag() throws JspException {
		
		
		StringBuffer tag = new StringBuffer();
		tag.append("<div class=\"col-xs-" + colWidth + "\">\n");
		tag.append("<div class=\"panel panel-info\">\n");
		if (caption.compareTo("") != 0)
		{
			tag.append("<div class=\"panel-heading\">");
			tag.append("<h3 class=\"panel-title\">" + caption + "</h3>");
			tag.append("</div>\n");
		}	
		tag.append("<div class=\"panel-body\">\n");
		tag.append("<form class=\"form-horizontal\" id='" + name + "' role=\"form\">\n");
		output(tag);
		return Tag.EVAL_PAGE;
	}
	
	@Override
	public int doEndTag() throws JspException {
		
		StringBuffer tag = new StringBuffer();
		tag.append("</form>\n");
		tag.append("</div>\n");
		tag.append("</div>\n");
		tag.append("</div>\n");
		output(tag);
		return Tag.EVAL_PAGE;
	}
	
	public String getFieldSize() {
		return fieldSize;
	}
	public void setFieldSize(String fieldSize) {
		this.fieldSize = fieldSize;
	}
	public String getLabelWidth() {
		return labelWidth;
	}
	public void setLabelWidth(String labelWidth) {
		this.labelWidth = labelWidth;
	}
	public String getFieldWidth() {
		return fieldWidth;
	}
	public void setFieldWidth(String fieldWidth) {
		this.fieldWidth = fieldWidth;
	}
		
}
